Component({
  properties: {
    position: {
      type: String,
      value: 'bottom-right' // 默认位置
    }
  },

  data: {
    showFontPanel: false,
    selectedFontSize: 'normal'
  },

  lifetimes: {
    attached() {
      const app = getApp()
      this.setData({
        selectedFontSize: app.getFontSize()
      })
    }
  },

  methods: {
    toggleFontPanel() {
      this.setData({
        showFontPanel: !this.data.showFontPanel
      })
    },

    onFontSizeChange(e) {
      const size = e.detail.value
      const app = getApp()
      
      this.setData({
        selectedFontSize: size,
        showFontPanel: false
      })

      app.setFontSize(size)

      wx.showToast({
        title: '已更新',
        icon: 'none',
        duration: 800
      })
    }
  }
}) 